/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import data.Vacancies;
import java.util.ArrayList;
import java.util.List;
import util.BaseDAO;

/**
 *
 * @author Hùng
 */
public class VacanciesDAO extends BaseDAO {

    public List<Vacancies> getallVancanies() {
        String hql = "from Vacancies";
        List<Vacancies> lVac = executeHQLQuery(hql);
        return lVac;
    }

    public Vacancies getVacancybyId(String tmpIdVac) {
        String hql = "from Vacancies v where v.vacancyid= '"+tmpIdVac+"'";
        List<Vacancies> lVac = executeHQLQuery(hql);
        if(lVac != null){
            return lVac.get(0);
        }
        return null;
    }

    public List<Vacancies> getallVancaniesbyNeeding() {
        String hql = "from Vacancies v where v.status='Needing'";
        List<Vacancies> lVac = executeHQLQuery(hql);
        return lVac;
    }
}
